﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PaketTrackerVerwaltung
{
    /// <summary>
    /// Interaction logic for Adresse.xaml
    /// </summary>
    public partial class Adresse : Window
    {
        public string PaketIdent { get; set; }
        
        public Adresse()
        {
            InitializeComponent();
        }

        private void txtPaketIdent_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            txtPaketIdent.Text = this.PaketIdent;

            PaketTrackerServer.WebservicesSoapClient client = new PaketTrackerServer.WebservicesSoapClient();
            PaketTrackerServer.Adresse absender = client.GetAdresse(PaketIdent, PaketTrackerServer.AdresseType.Absender);
            PaketTrackerServer.Adresse empfaenger = client.GetAdresse(PaketIdent, PaketTrackerServer.AdresseType.Empfaenger);

            txtAbsVorname.Text = absender.Vorname;
            txtAbsName.Text = absender.Name;
            txtAbsStrasse.Text = absender.Strasse + " " + absender.Hausnummer;
            txtAbsOrt.Text = absender.PLZ + " " + absender.Ort;

            txtEmpVorname.Text = empfaenger.Vorname;
            txtEmpName.Text = empfaenger.Name;
            txtEmpStrasse.Text = empfaenger.Strasse + " " + empfaenger.Hausnummer;
            txtEmpOrt.Text = empfaenger.PLZ + " " + empfaenger.Ort;


        }

        private void bttZurueck_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void bttVerlauf_Click(object sender, RoutedEventArgs e)
        {
            Verlauf wndVerlauf = new Verlauf();
            wndVerlauf.Owner = this;
            wndVerlauf.PaketIdent = PaketIdent;
            wndVerlauf.ShowDialog();
        }
    }
}
